/*
 * VectorListModel.java  0.4.0 / Oct 24, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.list;

import java.util.Vector;

/**
 * Vector List Model.
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class VectorListModel extends AbstractListModel {

// Private Fields. -------------------------------------------------------------

  private final Vector vector; // NOPMD

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new VectorListModel object.
   *
   * @param vector the vector model
   */
  public VectorListModel(Vector vector) { // NOPMD
    if (vector == null) {
      this.vector = new Vector(); // NOPMD
    } else {
      this.vector = vector;
    }
  }

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public Object getElementAt(int index) {
    return vector.elementAt(index);
  }

  /**
   * {@inheritDoc}
   */
  public int getSize() {
    return vector.size();
  }

}
